<?php

namespace app\admin\model;

use think\Model;


class Notice extends Model
{

    

    

    // 表名
    protected $name = 'notice';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];
    

    



    static public function newNotice($mold, $mold_id)
    {
        $title = '';
        $path = '';
        switch ($mold){
            case 'business':
                $business = model('app\admin\model\wdsxh\Business')->get($mold_id);
                $member_name = model('app\admin\model\wdsxh\Member')->where(['id' => $business->uid])->value('name');
                $title = "【{$member_name}】发布了一条商圈信息【{$business->title}】";
                $path = "/pages/Component/Module/Circle/Program/detail/index?id={$business->id}";
                break;
        }
        if(!empty($title)){
            model('app\admin\model\Notice')->create([
                'title' => $title,
                'path' => $path,
            ]);
        }
    }




}
